﻿Imports System.Text.RegularExpressions
Imports System
Imports System.Net
Imports System.IO

Public Class Form1
    Public debug As Boolean = False
    Public num_wafers As Integer

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        initialize_app()
    End Sub

    Private Sub bt_catch_maps_Click_1(sender As System.Object, e As System.EventArgs) Handles bt_catch_maps.Click
        Label2.Visible = True
        Label3.Visible = True
        Label4.Visible = True
        bt_catch_maps.Enabled = False
        Me.Refresh()
        get_all_map_files_mwh(tb_lot_id.Text)
        adjust_map_files()
        Shell("explorer.exe /e," & Chr(34) & My.Settings.dest_dir & Chr(34), vbMaximizedFocus)
        Me.Close()
    End Sub

    Private Sub tb_lot_id_TextChanged(sender As System.Object, e As System.EventArgs)
        If tb_lot_id.Text.Length >= 5 Then
            bt_catch_maps.Visible = True
        Else
            bt_catch_maps.Visible = False
        End If
    End Sub
    'OCR Stuff
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim checksum As String = GenerateSEMIOCRCheckSumm(tbOCRStringFragment.Text)
        Dim fullOCRString As String = GenerateSEMIOcrString(tbOCRStringFragment.Text)
        tbCheckSumResult.Text = checksum
        tbOCRStringResult.Text = fullOCRString
    End Sub
    'OCR Stuff
    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        If IsOCRSemiConformant(tbOCRStringFragment.Text) Then
            MessageBox.Show("OCR String IS Semi Conformant", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else
            MessageBox.Show("OCR String IS NOT Semi Conformant", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
        End If
    End Sub

    Private Sub CloseToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles CloseToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub OptionsToolStripMenuItem1_Click(sender As System.Object, e As System.EventArgs) Handles OptionsToolStripMenuItem1.Click
        Shell("explorer.exe /e," & Chr(34) & Environment.CurrentDirectory & Chr(34), vbMaximizedFocus)
        Me.Close()
    End Sub

End Class
